package com.woniuxy.controller;


import com.woniuxy.entity.Role;
import com.woniuxy.service.RoleService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/** 
 * @Auther: Li  <br/>
 * @Date: 2021/2/24:15:08  <br/>
 * @Description:角色增加、修改、删除、查询
 */

@RestController
@RequestMapping("role")
public class RoleController {

    @Resource
    private RoleService roleService;


    /**
     * Description : TODO  <br/>
     * ChangeLog : 1. 创建 (2021/2/24 15:08 [Li]); 
     * @param id  
     * @return com.woniuxy.entity.Role
    */
    @GetMapping("selectOne")
    public Role selectOne(Integer id) {
        return this.roleService.queryById(id);
    }

    /**
     * Description : TODO  <br/>
     * ChangeLog : 1. 创建 (2021/2/24 15:08 [Li]); 
     *
     * @return java.util.List<com.woniuxy.entity.Role>
    */
    @GetMapping("selectAll")
    public List<Role> selectAll() {
        return this.roleService.queryAll();
    }

    /**
     * Description : TODO  <br/>
     * ChangeLog : 1. 创建 (2021/2/24 15:08 [Li]); 
     * @param role  
     * @return int
    */
    @GetMapping("insert")
    public int insert(Role role) {
        return this.roleService.insert(role);
    }

    /**
     * Description : TODO  <br/>
     * ChangeLog : 1. 创建 (2021/2/24 15:08 [Li]); 
     * @param id  
     * @return int
    */
    @GetMapping("delete")
    public int delete(Integer id) {
        return this.roleService.deleteById(id);
    }

    /**
     * Description : TODO  <br/>
     * ChangeLog : 1. 创建 (2021/2/24 15:08 [Li]); 
     * @param role  
     * @return int
    */
    @GetMapping("update")
    public int update(Role role) {
        return this.roleService.update(role);
    }

}
